home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '91 / '91 Attendee Contributions / Heir ƒ 7⁄5⁄91 / Hier.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-29  |  1.3 KB  |  58 lines  |  [TEXT/KAHL]

  1. #define FALSE                (0)
  2. #define TRUE                (!FALSE)
  3.  
  4. #define PROC_ID                128
  5. #define FIRST_ICON_ID        129
  6. #define ERASE_ICON_ID        128
  7.     /*     (used to “erase” the first icon)    */
  8. #define FINAL_ICON_ID        130
  9. #define OLD_MENUSELECT        0xA93d
  10. int main(void);
  11.  
  12. /*********************** Main *********/
  13.  
  14. int main(void)
  15. {
  16.     Handle    HCodeRes;
  17.     long    LIgnoreResult;
  18.  
  19.       Handle    HProc;
  20.  
  21.     /*    Load the ShowIcon PROC resource    */
  22.       if ((HProc = GetResource('PROC', PROC_ID)) != 0L)
  23.           {
  24.         HLock(HProc);
  25.         CallPascal(FIRST_ICON_ID, 0, *HProc);
  26.         HUnlock(HProc);
  27.     }
  28.  
  29.  
  30.     if ((HCodeRes=GetResource('jpat',128)) != 0L)
  31.     {
  32.         DetachResource(HCodeRes);
  33.         /*    This is in the system heap so you don’t really want it high
  34.             however MoveHHi currently does nothing in the system and will
  35.             eventually move low.  Or so says Apple.    */
  36.         MoveHHi(HCodeRes);
  37.         HLock(HCodeRes);
  38.     };
  39.     
  40.     /*    get the old MenuSelect Trap    and put it into the header or code segment*/
  41.     (*((long **)HCodeRes))[3]=GetTrapAddress(OLD_MENUSELECT);
  42.  
  43.     SetTrapAddress((long)*HCodeRes,OLD_MENUSELECT);    /*  Menu Select */
  44.     Delay(20,&LIgnoreResult);    /*    to improve the animation of ShowIcon, but
  45.                                     at the cost of 1/3 of a second of machine boot
  46.                                     time.    */
  47.       if ((HProc = GetResource('PROC', PROC_ID)) != 0L)
  48.       {
  49.         HLock(HProc);
  50.         CallPascal(ERASE_ICON_ID, 0, *HProc);
  51.         CallPascal(FINAL_ICON_ID, -1, *HProc);
  52.         HUnlock(HProc);
  53.     }
  54. }
  55.  
  56.  
  57.  
  58.